/**
 * token-utils
 * @author linyn
 * @date 2025/10/29 10:27
 */

import { TOKEN_STORE_NAME } from "@/config/setting.ts";

/**
 * 获取token
 * @author linyn
 * @date 2025/10/29 10:27
 */
export function getToken() {
  return sessionStorage.getItem(TOKEN_STORE_NAME);
}

/**
 * 设置token
 * @param token
 * @author linyn
 * @date 2025/10/29 10:27
 */
export function setToken(token: string) {
  removeToken();
  sessionStorage.setItem(TOKEN_STORE_NAME, token);
}

/**
 * 移除原有的token
 * @author linyn
 * @date 2025/10/29 10:27
 */
export function removeToken() {
  sessionStorage.removeItem(TOKEN_STORE_NAME);
}
